<template>
  <div class="main">
    <!-- 头部 -->
    <div class="header">
      <div v-if="getAdminname" class="avatar">
        <img src="@/assets/xiaowan.jpg" alt="" />
        <span style="color: #fff">欢迎你，{{ getAdminname }}</span>
      </div>

      <div v-else class="avatar" @click="goLogin">
        <img src="@/assets/avator-icon.png" alt="" />
        <span style="color: #fff">点击登录</span>
      </div>
    </div>

    <!-- 卡片 -->
    <div class="my-order-tab">
      <div class="value">
        <span>0 张</span>
        <span style="color: #797d82">卖座券</span>
      </div>

      <div class="value">
        <span>￥ 0</span>
        <span style="color: #797d82">余额</span>
      </div>
    </div>

    <div class="my-card">
      <li>
        <img src="@/assets/01_center.png" alt="" />
        <span>电影订单</span>
      </li>
      <li>
        <img src="@/assets/02_center.png" alt="" />
        <span>组合红包</span>
      </li>
      <li>
        <img src="@/assets/03_center.png" alt="" />
        <span>帮助与客服</span>
      </li>
      <li>
        <img src="@/assets/04_center.png" alt="" />
        <span>设置</span>
      </li>
    </div>
  </div>
</template>

<script setup>
import { userStore } from '@/stores/user'
import { storeToRefs } from "pinia"
import { useRouter } from "vue-router";

const adminStore = userStore()
const { getAdminname } = storeToRefs(adminStore)
const router = useRouter()

const goLogin = () => {
  router.push("/Login");
}

</script>

<style scoped>
.main {
  width: 100%;
  height: 100%;
  background-color: #f4f4f4;
}

.header {
  overflow: hidden;
  background: url(@/assets/bg.png) no-repeat left;
  background-size: 100%;
  height: 158px;
}

.avatar {
  display: flex;
  align-items: center;
  margin: 40px;
  margin-left: 20px;
}

.avatar img {
  width: 65px;
  height: 65px;
  border: 2px solid #fff;
  border-radius: 50px;
  margin-right: 20px;
}

span {
  color: #191a1b;
  font-size: 14px;
}

.my-order-tab {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 20px;
  background-color: #fff;
}

.value {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  height: 38px;
}

.my-card {
  height: 200px;
  margin-top: 10px;
  background-color: #fff;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  flex-direction: column;
  padding: 0 20px;
}

.my-card img {
  width: 20px;
  height: 20px;
  margin-right: 18px;
}

.my-card li {
  width: 100%;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ededed;
  padding: 15px 0;
}
</style>
